package ch.ti.bfh.app.loodel.internal;

import ch.ti.bfh.app.loodel.domain.timeslot.Location;
import ch.ti.bfh.app.loodel.domain.timeslot.TimeSlot;
import ch.ti.bfh.app.loodel.service.TimeSlotData;
import ch.ti.bfh.app.loodel.service.create.ShowTimeSlotLocationData;

public final class TimeSlotAssembler {

    public static TimeSlotData getTimeSlotData(TimeSlot timeSlot) {
        TimeSlotData timeSlotData = new TimeSlotData();
        timeSlotData.setDateTimeInterval(timeSlot.getInterval());
        timeSlotData.setDuration(timeSlot.getDuration());
        timeSlotData.setShortStartDateTime(timeSlot.getShortStartDateTime());
        timeSlotData.setShortEndDateTime(timeSlot.getShortEndDateTime());
        timeSlotData.setLongTitle(timeSlot.getTimeSlotLongTitle());
        timeSlotData.setLearningEventGroupName(timeSlot.getLearningEvent().getGroupName());
        timeSlotData.setLearningEventModuleName(timeSlot.getLearningEvent().getModulName());
        timeSlotData.setTimeSlotId(timeSlot.getId());
        timeSlotData.setVoteCount(timeSlot.getVoteCount());
        timeSlotData.setLocationName(timeSlot.getLocation().getName());
        timeSlotData.setPlace(timeSlot.getLocation().getPlace());
        timeSlotData.setStreet(timeSlot.getLocation().getStreet());
        return timeSlotData;
    }

    public static ShowTimeSlotLocationData createTimeSlotLocationData(Long timeSlotId, Location location) {
        return new ShowTimeSlotLocationData(location.getPlace(), location.getStreet(), location.getName());
    }
}
